############################################################################## 
#
# Copyright (c) 2010 Xilinx, Inc.  All rights reserved.
#
# Xilinx, Inc.
# XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" AS A 
# COURTESY TO YOU.  BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS
# ONE POSSIBLE   IMPLEMENTATION OF THIS FEATURE, APPLICATION OR 
# STANDARD, XILINX IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION
# IS FREE FROM ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE 
# FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION.  
# XILINX EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO 
# THE ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO 
# ANY WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE 
# FROM CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY 
# AND FITNESS FOR A PARTICULAR PURPOSE.
# 
# Top level Makefile
#
# $Id: $
#
##############################################################################

#
# Processor architecture
# microblaze
#
ARCH = microblaze

SYSTEMDIR = ../../..

TOPDIR = .

ARCH_PREFIX = mb

#
# gnu tools for Makefile
#
CC = $(ARCH_PREFIX)-gcc
AR = $(ARCH_PREFIX)-ar
CP = cp

#
# Compiler, linker and other options.
#
CFLAGS = ${COMPILER_FLAGS} ${EXTRA_COMPILER_FLAGS} 

#
# System project directories.
#
LIBDIR = $(SYSTEMDIR)/lib
INCLUDEDIR = $(SYSTEMDIR)/include

# Kernel library. 
LIBFREERTOS = ${LIBDIR}/libfreertos.a

INCLUDEFILES =	${TOPDIR}/*.h

INCLUDES = -I$(INCLUDEDIR) \
	-I${TOPDIR}

KERNEL_AR_OBJS = *.c *.S

OUTS = *.o

libs:	$(KERNEL_AR_OBJS)
	@echo "Compiling FreeRTOS"
	@$(COMPILER) $(COMPILER_FLAGS) $(EXTRA_COMPILER_FLAGS) $(INCLUDES) $^
	@$(ARCHIVER) -r ${LIBFREERTOS} ${OUTS}
	make clean

.PHONY: include
include:
	${CP} ${INCLUDEFILES} ${INCLUDEDIR}

clean:
	rm -rf ${OUTS}
